using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework.Graphics;

namespace RIVER_RAID
{
    class GerenciadorObstaculo
    {

        private List<Obstaculo> lista;

        public GerenciadorObstaculo()
        {
            lista = new List<Obstaculo>();
        }

        public void Add(Obstaculo b)
        {
            lista.Add(b);
        }


        //public bool verificarColisao(Tiro obs)
        //{
         //   Obstaculo[] t = lista.ToArray();
           // int i = 0;
            //while ((i < t.Length)&& (obs!=null))
            //{
              //  if ((obs.pos.Y>=t[i].pos.Y) && (obs.pos.Y<=t[i].pos.Y+t[i].altura) &&
               //     (obs.pos.X>= t[i].pos.X) && (obs.pos.X <= t[i].pos.X + t[i].largura)
                //    )
                //{
                  //  lista.Remove(t[i]);
                    //return true;
                //}
                //i++;
            //}
          //  return false;
        //}

        public void drawObstaculo(Texture2D texture, SpriteBatch SB )
        {
            Obstaculo[] b = lista.ToArray();

            for (int i = 0; i < b.Length;i++ )
            {
                DrawObstaculo.draw(b[i], SB, texture);
                if (b[i].pos.Y >600)
                {
                    lista.Remove(b[i]);
                }
            }
        }
    
    }
}
